package com.tourManagement.controller;

import com.tourManagement.entity.RT;
import com.tourManagement.entity.订单信息;
import com.tourManagement.service.订单管理Service;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;

@RestController
@AllArgsConstructor
@RequestMapping("/order")
public class 订单管理Controller {
    private 订单管理Service orderS;

    @GetMapping("/addOrder")
    public RT addOrder(订单信息 data) throws SQLException {
        return RT.success(orderS.addOrder(data));
    }

    @GetMapping("/deleteOrder")
    public RT deleteOrder(Integer orderId) throws SQLException {
        return RT.success(orderS.deleteOrder(orderId));
    }

    @GetMapping("/updateOrder")
    public RT orderPayment(Integer orderId) throws SQLException {
        return RT.success(orderS.orderPayment(orderId));
    }

    @GetMapping("/selectOne")
    public RT selectOneOrder(String userName) throws SQLException {
        return RT.success(orderS.selectOneOrder(userName));
    }

    @GetMapping("/selectAll")
    public RT selectAllOrder() throws SQLException {
        return RT.success(orderS.selectAllOrder());
    }
}
